﻿using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SportAnalyzer
{
    public partial class Form1 : Form
    {
        

        public Form1()
        {
            InitializeComponent();
        }

        private void sessionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 newSession = new Form2();
            newSession.Show();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox1 aboutBox = new AboutBox1();
            aboutBox.Show();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void polarXMLFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form3 importXmlForm = new Form3();
            importXmlForm.Show(this);
        }

        private void gpxFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form4 importGpxForm = new Form4();
            importGpxForm.Show(this);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //if bat sartu behar da fitxategia ez bada existitzen sortzeko
            if(File.Exists("filename.xml"))
            {
                Program.mainDocument = SportAnalyzerDataSet.sportAnalyzerDocument.LoadFromFile("filename.xml");
            }


            fillDataGrid();
        }

        private void fillDataGrid()
        {
            dataGridView1.DataSource = Program.mainDocument;
                       
        }

    }
}
